<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "order".
 *
 * @property integer $id
 * @property integer $active_id
 * @property integer $goods_id
 * @property integer $num_total
 * @property integer $num_goods
 * @property string $price_total
 * @property string $price_discount
 * @property integer $time_confirm
 * @property integer $time_pay
 * @property integer $time_over
 * @property integer $time_cancel
 * @property string $goods_info
 * @property integer $sys_dateline
 * @property integer $sys_lastmodify
 * @property integer $sys_status
 * @property string $sys_ip
 * @property string $uid
 * @property string $username
 */
class Order extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'order';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['active_id', 'goods_id', 'num_total', 'num_goods', 'time_confirm', 'time_pay', 'time_over', 'time_cancel', 'sys_dateline', 'sys_lastmodify', 'sys_status', 'uid'], 'integer'],
            [['price_total', 'price_discount'], 'number'],
            [['goods_info', 'sys_ip', 'uid', 'username'], 'required'],
            [['goods_info'], 'string'],
            [['sys_ip', 'username'], 'string', 'max' => 50],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '订单ID',
            'active_id' => '活动ID',
            'goods_id' => '商品ID',
            'num_total' => '购买的单品数量',
            'num_goods' => '购买的商品种类数量',
            'price_total' => '订单总金额',
            'price_discount' => '优惠后实际金额',
            'time_confirm' => '确认订单时间',
            'time_pay' => '支付时间',
            'time_over' => '过期时间',
            'time_cancel' => '取消时间',
            'goods_info' => '订单商品详情，JSON格式保存',
            'sys_dateline' => '创建时间',
            'sys_lastmodify' => '最后修改时间',
            'sys_status' => '状态，0 初始状态，1 待支付，2 已支付，3 已过期，4 管理员已确认，5 已取消，6 已删除，7 已发货，8 已收货，9 已完成',
            'sys_ip' => '用户IP',
            'uid' => '用户ID',
            'username' => '用户名',
        ];
    }
}
